#include "server_subwindow4.h"
#include "ui_server_subwindow4.h"


server_subwindow4::server_subwindow4(QWidget *parent, Qt::WFlags flags)
	: QWidget(parent, flags)
{
	ui = new Ui::server_subwindow4;
	ui->setupUi(this);

	//connect(ui.treeView,SIGNAL(clicked(QModelIndex)),this,SLOT(on_treeView_Clicked()));
	//	iterateOverItems();
}

server_subwindow4::~server_subwindow4()
{
	delete ui;
}

void server_subwindow4::setupValues()
{
    ui->lineEdit_1->setText( (QString)m_device_item->id() );
    ui->lineEdit_2->setText( m_device_item->name() );
    ui->lineEdit_3->setText( QString::number( m_device_item->device_type()->id() ) );

    foreach(nr_device_type* device_type, m_device_type_manager->device_types())
    {
        if ( device_type->id() == m_device_item->device_type()->id() )
        {
            ui->lineEdit_4->setText( QString::number( device_type->id() ) );
            ui->lineEdit_5->setText( device_type->name() );
            ui->lineEdit_6->setText( device_type->text() );
            ui->lineEdit_7->setText( device_type->category() );
            ui->lineEdit_8->setText( device_type->description() );
            ui->lineEdit_9->setText( device_type->module() );
        }
    }

    foreach( nr_device_property* device_property, m_device_item->properties() )
    {
        foreach(nr_device_property* device_property2, device_property->children())
        {
            switch ( device_property2->id() )
            {
            case 1:
                //QString::number( device_property->id() );
                ui->lineEdit_10->setText( device_property2->value().toString() );
                break;
            case 2:
                ui->lineEdit_11->setText( device_property2->value().toString() );
                break;
            }
        }
    }
}
